<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>商家管理后台</title>
	<link type="image/x-icon" href="<?php echo IUrl::creatUrl("")."favicon.ico";?>" rel="icon">
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/jquery/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/artdialog/artDialog.js?v=20200606"></script><script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/artdialog/plugins/iframeTools.js?v=2023"></script><link rel="stylesheet" type="text/css" href="/runtime/_systemjs/artdialog/skins/white.css" />
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/form/form.js"></script>
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/artTemplate/artTemplate.js"></script><script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/artTemplate/artTemplate-plugin.js"></script>
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/autovalidate/validate.js?v=20200606"></script><link rel="stylesheet" type="text/css" href="/runtime/_systemjs/autovalidate/style.css" />
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/cookie/jquery.cookie.js"></script>
	<script type='text/javascript' src="<?php echo $this->getWebViewPath()."javascript/html5.js";?>"></script>
	<!--[if lt IE 9]>
	<link rel="stylesheet" href="<?php echo $this->getWebSkinPath()."css/ie.css";?>" type="text/css" media="screen" />
	<![endif]-->
	<link rel="stylesheet" href="<?php echo $this->getWebSkinPath()."css/admin.css";?>" type="text/css" media="screen" />
	<script type='text/javascript' src="<?php echo IUrl::creatUrl("")."public/javascript/public.js";?>"></script>
	<?php $seller_id = $this->seller['seller_id'];$seller_name = $this->seller['seller_name'];?>
</head>

<body>
	<!--头部 开始-->
	<header id="header">
		<nav class="navbar">
			<div class="container-fluid">
				<div class="navbar-holder d-flex align-items-center justify-content-between">
					<div class="navbar-header">
						<h1 class="site_title">
						    <a href="<?php echo IUrl::creatUrl("/seller/index");?>"><?php echo $this->_siteConfig->name;?>商家管理</a>
						</h1>
					</div>

					<ul class="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
						<li class="nav-item"><a class="nav-link" href="<?php echo IUrl::creatUrl("");?>" target="_blank">网站首页</a></li>
						<li class="nav-item"><a class="nav-link" href="<?php echo IUrl::creatUrl("/site/home/id/".$seller_id."");?>" target="_blank">商家主页</a></li>
						<li class="nav-item"><a class="nav-link" href="<?php echo IUrl::creatUrl("/systemseller/logout");?>">退出登录</a></li>
					</ul>
				</div>
			</div>
		</nav>
	</header>
	<!--头部 结束-->

	<div class="page-content d-flex align-items-stretch">
		<!--侧边栏菜单 开始-->
		<nav id="sidebar" class="side-navbar">
			<ul class="list-unstyled">
				<?php foreach($items=menuSeller::init() as $key => $item){?>
				<li>
				    <a href="#<?php echo isset($key)?$key:"";?>" aria-expanded="false" data-toggle="collapse" name="menuItems" title="<?php echo isset($key)?$key:"";?>">
				        <i class=""></i> <?php echo isset($key)?$key:"";?>
				    </a>

					<ul id="<?php echo isset($key)?$key:"";?>" name="leftMenu" class="collapse list-unstyled" data-parent="#sidebar">
						<?php foreach($items=$item as $moreKey => $moreValue){?>
						<li><a href="<?php echo IUrl::creatUrl("".$moreKey."");?>"><?php echo isset($moreValue)?$moreValue:"";?></a></li>
						<?php }?>
					</ul>
				</li>
				<?php }?>
			</ul>
		</nav>
		<!--侧边栏菜单 结束-->

		<!--主体内容 开始-->
		<section class="content-inner">
			<?php $countData = statistics::sellerAmount($this->seller['seller_id']);?>
<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/echarts/echarts.simple.min.js"></script>
<article class="module width_full">
	<div class="module_content dashboard-counts">
		<div class="container-fluid">
			<div class="card-header d-flex align-items-center">
				<h3>概要信息</h3>
			</div>
			<div class="row bg-white has-shadow">
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-violet"><i class="fa fa-inbox fa-2x"></i></div>
							<div class="text">
							    <strong><a href="<?php echo IUrl::creatUrl("/seller/goods_list");?>"><?php echo Api::run('goodsCount');?></a></strong><br><small>商品总数量</small>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-red"><i class="fa fa-comments fa-2x"></i></div>
							<div class="text">
							    <strong><a href="<?php echo IUrl::creatUrl("/seller/refer_list");?>"><?php echo Api::run('referWaitCount');?></a></strong><br><small>待回复咨询</small>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-yellow"><i class="fa fa-comments-o fa-2x"></i></div>
							<div class="text">
							    <strong><a href="<?php echo IUrl::creatUrl("/seller/comment_list");?>"><?php echo Api::run('commentWaitCount');?></a></strong><br><small>待回复评论</small>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-green"><i class="fa fa-truck fa-2x"></i></div>
							<div class="text">
								<strong><a href="<?php echo IUrl::creatUrl("/seller/order_list/search[distribution_status]/0/search[pay_status]/1/search[status]/2");?>"><?php echo Api::run('orderWaitCount');?></a></strong><br><small>待发货订单</small>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-green"><i class="fa fa-address-card fa-2x"></i></div>
							<div class="text">
								<strong><?php echo statistics::gradeSeller($this->seller['seller_id']);?></strong><br><small>信用评分</small>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-yellow"><i class="fa fa-thumbs-o-down fa-2x"></i></div>
							<div class="text">
							    <strong><a href="<?php echo IUrl::creatUrl("/seller/refundment_list");?>"><?php echo Api::run('refundsCount');?></a></strong><br><small>退款申请</small>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-red"><i class="fa fa-cog fa-2x"></i></div>
							<div class="text">
							    <strong><a href="<?php echo IUrl::creatUrl("/seller/fix_list");?>"><?php echo Api::run('fixWaitCount');?></a></strong><br><small>维修申请</small>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-violet"><i class="fa fa-retweet fa-2x"></i></div>
							<div class="text">
							    <strong><a href="<?php echo IUrl::creatUrl("/seller/exchange_list");?>"><?php echo Api::run('exchangeWaitCount');?></a></strong><br><small>换货申请</small>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</article>

<article class="module width_full">
	<div class="module_content dashboard-counts">
		<div class="container-fluid">
			<div class="card-header d-flex align-items-center">
				<h3>资金统计</h3>
			</div>
			<div class="row bg-white has-shadow">
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-red"><i class="fa fa-diamond fa-2x"></i></div>
							<div class="text">
								<strong><?php echo Api::run('getSellerSellAmount',$this->seller['seller_id']);?> 元</strong><br><small>累计订单总额</small>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-violet"><i class="fa fa-calendar-check-o fa-2x"></i></div>
							<div class="text">
								<strong><?php echo Api::run('getSellerSellAmount',$this->seller['seller_id'],date('Y-m-01'),date('Y-m-d').' 23:59:59');?> 元</strong><br><small>本月订单总额</small>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-green"><i class="fa fa-cubes fa-2x"></i></div>
							<div class="text">
								<strong><?php echo Api::run('getSellerOrderNumCheckout',$this->seller['seller_id']);?> 单</strong><br><small>可提现订单数</small>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xl-3 col-sm-3">
					<div class="item d-flex align-items-center">
						<div class="statistic d-flex align-items-center">
							<div class="icon bg-yellow"><i class="fa fa-credit-card fa-2x"></i></div>
							<div class="text">
								<strong><?php echo Api::run('getSellerBillPay',['#seller_id#',$this->seller['seller_id']]);?> 元</strong><br><small>累计提现金额</small>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</article>

<article class="module width_full">
	<div class="module_content dashboard-counts">
		<div class="container-fluid">
			<div class="card-header d-flex align-items-center">
				<h3>销售统计</h3>
			</div>
			<div class="row bg-white has-shadow">
				<div class="col-xl-12 col-sm-12">
					<div class="item d-flex align-items-center">
						<div id="myChart" style="width:100%;min-height:320px;"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</article>

<script type='text/javascript'>
//图表生成
$(function()
{
	//图标模板
	var option = {
		title:
		{
			text:''
		},
		xAxis:
		{
			name:'时间',
			data:<?php echo JSON::encode(array_keys($countData));?>,
		},
		yAxis:
		{
			name:'销售额(元)'
		},
		series:
		[
			{
				name:'销售额',
				type: 'line',
				data:<?php echo JSON::encode(array_values($countData));?>
			}
		],
		tooltip:
		{
			show:true
		}
	};
	echarts.init(document.getElementById('myChart')).setOption(option);
})
</script>
		</section>
		<!--主题内容 结束-->
	</div>

	<script src="<?php echo IUrl::creatUrl("")."public/javascript/twitter-bootstrap/4.1.3/js/bootstrap.bundle.min.js";?>"></script>
	<script src="<?php echo IUrl::creatUrl("")."public/javascript/twitter-bootstrap/4.1.3/js/bootstrap.min.js";?>"></script>

	<script type="text/javascript">
	//菜单图片ICO配置
	function menuIco(val)
	{
		var icoConfig = {
			"统计结算模块" : "fa fa-bar-chart-o",
			"商品模块" : "fa fa-inbox",
			"订单模块" : "fa fa-file-text",
			"营销模块" : "fa fa-bullhorn",
			"配置模块" : "fa fa-gears"
		};
		return icoConfig[val] ? icoConfig[val] : "fa fa-list";
	}

	$("[name='menuItems']").each(function()
	{
		$(this).find("i").addClass(menuIco($(this).attr('title')));
	});

    //兼容IE系列
    $("[name='leftMenu'] [href^='javascript:']").each(function(i)
    {
    	var fun = $(this).attr('href').replace("javascript:","");
    	$(this).attr('href','javascript:void(0)');
    	$(this).on("click",function(){eval(fun)});
    });

    //重置容器高度
    function resizeContentHeight()
    {
        var winHeight     = $(window).height();
        var contentHeight = $('.page-content').outerHeight();
        var finnalHeight  = winHeight >= contentHeight ? winHeight : contentHeight;
        $('.page-content').css('height',finnalHeight);
        $('#sidebar').css('height',winHeight - 75);
    }

    //窗口大小调整触发
    window.onresize = resizeContentHeight;
    jQuery(function()
    {
        resizeContentHeight();
    });

    //获取左侧菜单项
    function matchLeftMenu(leftItem)
    {
        var matchObject = $('[name="leftMenu"]>li a[href="'+leftItem+'"]');
        if(matchObject.length > 0)
        {
            $.cookie('lastUrl', leftItem);
            return matchObject;
        }

        var lastUrl = $.cookie('lastUrl');
        if(lastUrl)
        {
            return $('[name="leftMenu"]>li a[href="'+lastUrl+'"]');
        }
        return null;
    }

    //左边栏菜单高亮
    var leftItem   = "<?php echo IUrl::getUri();?>";
    var matchObject = matchLeftMenu(leftItem);
    if(matchObject)
    {
        matchObject.parent().addClass('active').parent().collapse("show");
    }
	</script>
</body>
</html>